package com.boang.controller.owners;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.boang.entity.PO.OwnerApply;
import com.boang.entity.Unit;
import com.boang.resp.Result;
import com.boang.service.OwnerApplyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "业主认证cert", description = "业主认证相关接口")
@RestController
@RequestMapping("/api/cert")
public class CertController {
    @Autowired
    private OwnerApplyService applyService;


    // 业主提交认证


    @PostMapping("/apply")
    @Operation(summary = "业主提交认证")
    public Result<?> submitApply(@RequestBody OwnerApply dto) {
        applyService.submitApply(dto);
        return Result.ok();
    }

    //-------------------分页查询--------------------
    @GetMapping("/page")
    @Operation(summary = "分页查询")
    public Result<Page<Unit>> page(int pageNum, int pageSize) {
        Page page = new Page(pageNum, pageSize);
        return Result.ok(applyService.page(page));
    }

}